<?php
/**
 * Created by PhpStorm.
 * User: Monkey
 * Date: 2021/10/13
 * Time: 11:27
 * Desc: 登陆
 */

namespace app\backend\validate;

use think\Validate;

class MenuValidate extends Validate
{
    protected $rule = [
        'id' => 'require|integer',
        'name' => 'require|max:20',
        'type' => 'require|in:0,1',
        'sort' => 'integer',
        'is_show' => 'require|in:0,1',
    ];

    protected $message = [
        'id.require' => 'ID不能为空',
        'id.integer' => 'ID格式错误',
        'name.require' => '菜单名不能为空',
        'name.max' => '菜单名最多20位',
        'type.require' => '按钮类型不能为空',
        'type.in' => '按钮类型格式错误',
        'sort.integer' => '排序格式错误',
        'is_show.require' => '隐藏状态不能为空',
        'is_show.in' => '隐藏状态参数格式错误',
    ];

    protected $scene = [
        'add' => ['name','type','sort','is_show'],
        'edit' => ['id','name','type','sort','is_show'],
        'del' => ['id']
    ];
}
